rows = [
    {'fname': 'Brian', 'lname': 'Jones', 'uid': 1003},
    {'fname': 'David', 'lname': 'Beazley', 'uid': 1002},
    {'fname': 'Aohn', 'lname': 'Cleese', 'uid': 1001},
    {'fname': 'Aig', 'lname': 'Jones', 'uid': 1004}
]

## 根据任意的字典字段来排序 输入结果行
from operator import itemgetter
rows_by_fname = sorted(rows,key=itemgetter("fname"))
rows_by_uid = sorted(rows,key=itemgetter("uid"))

for item in rows_by_fname:
    print(item)

print("========================")

for item in rows_by_uid:
    print(item)

print("-------------------------")
print(min(rows, key=itemgetter('uid')))
print(max(rows, key=itemgetter('uid')))